﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Threading.Tasks;
using Quartz;
using Common.Logging;
using Quartz.Impl;

namespace Kingdee.WeksErp.AnyAndSyncService
{
    public partial class AnySyncService : ServiceBase
    {
        private IScheduler scheduler;
        private readonly ILog logger;
        public AnySyncService()
        {
            InitializeComponent();
            ISchedulerFactory schedulerFactory = new StdSchedulerFactory();
            scheduler = schedulerFactory.GetScheduler();
            logger = LogManager.GetLogger(GetType());
        }

        protected override void OnStart(string[] args)
        {
            logger.Info("Quartz服务成功启动");
            scheduler.Start();
        }

        protected override void OnStop()
        {
            scheduler.Shutdown(false);
        }
    }
}
